package com.example.hf_v1.controller;


import com.example.hf_v1.config.Result;
import com.example.hf_v1.entity.Face;
import com.example.hf_v1.service.IFaceService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 脸型表 前端控制器
 * </p>
 *
 * @author 浪花骑士
 * @since 2024-08-10
 */
@RestController
@RequestMapping("/face")
public class FaceController {
    @Resource
    private IFaceService faceService;

    //增加脸型
    @RequestMapping("/addFace")
    public Result addFace(@RequestBody Face face) {
        return Result.success(faceService.save(face));
    }

    //删除脸型
    @RequestMapping("/deleteFace")
    public Result deleteFace(Integer id){
        return Result.success(faceService.removeById(id));
    }

    //修改脸型
    @RequestMapping("/updateFace")
    public Result updateFace(@RequestBody Face face){
        return Result.success(faceService.updateById(face));
    }
    //查询所有��型
    @RequestMapping("/selectAllFaces")
    public Result selectAllFaces(){
        return Result.success(faceService.list());
    }

}
